/// @tags:
#include <cstdio>
#include <iostream>
#include <map>
#include <vector>
#define rint register int
#define id(i, j) ((i)*m + (j))

using std::cin;
using std::cout;

namespace BlueQuantum {

typedef long long ULL;

constexpr int MAXN = 10;

int n, m;
int mat[MAXN][MAXN];

inline ULL getHash(const std::vector<int> &vec) {
  constexpr int P = 233;
  ULL res = 0;
  for (auto i : vec) {
    res = res * P + i;
  }
  return res;
}

/* inline ULL getHash(const std::vector<ULL> &vec) {
  constexpr int P = 27;
  ULL res = 0;
  for (auto i : vec) {
    res = res * P + i;
  }
  return res;
} */

std::map<std::vector<ULL>, bool> map;
// std::map<ULL, bool> map;
std::vector<int> A, B, C;

inline int main() {
  cin >> n >> m;
  int lim = n * m;
  A.resize(n + 1), B.resize(m + 1), C.resize(m + 1);
  for (int j = 1; j <= m; ++j) mat[0][j] = mat[n + 1][j] = 1;
  for (int i = 1; i <= n; ++i) mat[i][0] = mat[i][m + 1] = 1;
  for (rint status = 0; status < 1 << lim; ++status) {
    for (rint i = 1; i <= n; ++i) {
      for (rint j = 1; j <= m; ++j) {
        // cout << id(i - 1, j - 1) << '\n';
        mat[i][j] = (status >> (id(i - 1, j - 1))) & 1;
      }
    }
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= m + 1; ++j) {
        if (mat[i][j]) {
          A[i] = j;
          break;
        }
      }
    }
    for (int j = 1; j <= m; ++j) {
      for (int i = 1; i <= n + 1; ++i) {
        if (mat[i][j]) {
          B[j] = i;
          break;
        }
      }
      for (int i = n; i >= 0; --i) {
        if (mat[i][j]) {
          C[j] = i;
          break;
        }
      }
    }
    // cout << status << '\n';
    // for (auto i : A) cout << i << ' ';
    // cout << '\n';
    // for (auto i : B) cout << i << ' ';
    // cout << '\n';
    // for (auto i : C) cout << i << ' ';
    // cout << '\n';
    // cout << getHash(std::vector<ULL>{getHash(A), getHash(B), getHash(C)}) << '\n';
    // cout << '\n';
    // map.emplace(getHash(std::vector<ULL>{getHash(A), getHash(B), getHash(C)}), true);
    map.emplace(std::vector<ULL>{getHash(A), getHash(B), getHash(C)}, true);
  }
  cout << map.size();
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("matrix.in", "r", stdin);
  freopen("matrix.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
